**Replication code for Figures in: Kelemen, R. Daniel, and Tommaso Pavone. 2023. “Where Have the Guardians Gone? Law Enforcement and the Politics of Supranational Forbearance in the European Union." World Politics 74 (4).

**Created by Tommaso Pavone, Assistant Professor at the University of Toronto, in July 2023


*****************************************************
**For figures 1-5, use the following dataset:
use "Kelemen&Pavone_YearLevel_1978-2019_Infringement&Complaint&PrelimRefs_LegislativeOutputData_WPDataverse.dta"

*To recreate the top graph of Figure 1 (Total Infringements Opened & Referred to the ECJ, 1978-2019)
graph twoway scatter Letters_YearSum Year, yaxis(1) || scatter Referrals_YearSum Year, yaxis(2) || lowess Letters_YearSum Year, yaxis(1) bwidth(0.3) || lowess Referrals_YearSum Year, yaxis(2) bwidth(0.3)

*To recreate the bottom graph of Figure 1 (Total Infringements Opened & Referred to the ECJ per Member State, 1978-2019)
graph twoway scatter Letters_PerMS_nolag Year, yaxis(1) || scatter Referrals_PerMS_twoyrlag Year, yaxis(2) || lowess Letters_PerMS_nolag Year, yaxis(1) bwidth(0.3) || lowess Referrals_PerMS_twoyrlag Year, yaxis(2) bwidth(0.3)

*To recreate Figure 3 (Complaints to the Commission and Infringements Opened, 1978-2019)
graph twoway scatter Letters_YearSum Year, yaxis(1) || scatter Complaints_YearSum Year, yaxis(2)|| lowess Letters_YearSum Year, yaxis(1) bwidth (0.3) || lowess Complaints_YearSum Year if Year<=1999, yaxis(2) bwidth (0.6) || lowess Complaints_YearSum Year if Year>=2008, yaxis(2) bwidth (0.6)

*To recreate Figure 4 (Commission Infringements and Preliminary References to the ECJ, 1978-2019)
graph twoway scatter Letters_YearSum Year, yaxis(1) || scatter year_prelimrefs_tot Year, yaxis(2)|| lowess Letters_YearSum Year, yaxis(1) bwidth (0.3) || lowess year_prelimrefs_tot Year, yaxis(2) bwidth (0.3)

*To recreate Figure 5 (Infringements Opened and Referred to ECJ per Number of Violative Opportunities, 1978-2019)
graph twoway scatter letters_divided_legoutputxnumMs Year, yaxis(1) || scatter refer_divided_legxnumMslagged Year, yaxis(2)|| lowess letters_divided_legoutputxnumMs Year, yaxis(1) bwidth (0.3) || lowess refer_divided_legxnumMslagged Year, yaxis(2) bwidth (0.3)

*****************************************************
**For figure 6, use the following dataset
use "Kelemen&Pavone_YearLevel_2002-2019_DiscretionaryInfringements&EUPilotData_WPDataverse.dta"

*To recreate figure 6 (Discretionary Infringements Opened With EU Pilot Policy Shaded, 2002-2019)
generate upper=650
local barcall1 upper Year if Mandatory_pilot_year==1
local barcall2 upper Year if Discretionary_pilot_year==1
twoway bar `barcall1' || bar `barcall2' || scatter discretionary_infring_yeartot Year || lowess discretionary_infring_yeartot Year, bwidth(0.6)

*****************************************************
**For figures 7 and 8, use the following dataset
use "Kelemen&Pavone_YearLevel_1997-2018_CommissionWinRate&ECJChamberSizeData_WPDataverse.dta"

*to recreate figure 7 (Average ECJ Chamber Size in Infringement Cases, 1997-2018)
graph twoway scatter avgyearly_njudges Year || lowess avgyearly_njudges Year, bwidth(0.6)

*to recreate figure 8 (Commission Win Rate in Infringement Cases, 1997-2018)
graph twoway scatter comm_win_percyear Year || lowess comm_win_percyear Year, bwidth(0.6)


*****************************************************
**For figure A1 in the Appendix, use the following dataset
use "Kelemen&Pavone_CountryYearLevel_1978-2019_Infringement&Complaint&PrelimRefs_LegislativeOutputData_WPDataverse.dta"

*To recreate figure A1 in the Appendix (Commission Infringements Lodged by Member State, 1978-2019)
graph twoway line Letters_Tot_NoDup Year, by(Country) yaxis(1) || line Referrals_Tot_NoDup Year, by(Country) yaxis(2)


*****************************************************
**For figure A2 in the Appendix, use the following dataset
use "Kelemen&Pavone_InfringementLevel_2002-2019_Infringement&PolicyAreaData_WPDataverse.dta"

*To recreate figure A2 in the Appendix (Commission Infringements Lodged by Policy Area, 2002-2019)
graph twoway line infringements_Area_Stage_YearTot Year if Dec_Type_Num==1, by(Policy_Area_Num) yaxis(1) || line infringements_Area_Stage_YearTot Year if Dec_Type_Num==3, by(Policy_Area_Num) yaxis(2)
